<com:TPanel id="PortletEditMode" Style="border-bottom: 1px solid black; margin: 0px 0px 0px 0px; text-align: right;">
<com:TImageButton OnClick="MoveButtonClicked" ImageURL="<%=$this->Page->getTheme()->getBaseUrl()%>/images/edit/page_next.gif" Text="Move to another area" />
<com:TImageButton OnClick="UpButtonClicked" ImageURL="<%=$this->Page->getTheme()->getBaseUrl()%>/images/edit/page_up.gif" Text="Move portlet up" />
<com:TImageButton OnClick="DownButtonClicked" ImageURL="<%=$this->Page->getTheme()->getBaseUrl()%>/images/edit/page_down.gif" Text="Move portlet down" />
<com:TImageButton OnClick="PropertyButtonClicked" ImageURL="<%=$this->Page->getTheme()->getBaseUrl()%>/images/edit/application_form.png" Text="Properties" />
<com:TImageButton OnClick="DeleteButtonClicked" ImageURL="<%=$this->Page->getTheme()->getBaseUrl()%>/images/edit/application_delete.png" Text="Remove portlet" Attributes.onclick="if(!confirm('Are you sure?')) return false;"/>
</com:TPanel>

<com:TPanel id="grpDlGroups" GroupingText="Available groups" Style="width: 100%;">
<com:TDataList
	ID="dlDownloadGroups"
	DataKeyField="id"
	PageSize="5"
	AllowPaging="true"
	AllowCustomPaging="true"
	EnableViewState="true"
	OnEditCommand="editItemDlGroup"
	OnCancelCommand="cancelItemDlGroup"
	OnUpdateCommand="updateItemDlGroup"
	OnDeleteCommand="deleteItemDlGroup"
	HeaderStyle.CssClass="grid-header"
	ItemStyle.CssClass="grid-row1"
	ItemStyle.Width="100%"
	AlternatingItemStyle.CssClass="grid-row2"
	EditItemStyle.CssClass="grid-row-edit"
	SelectedItemStyle.CssClass="grid-row-selected"
	OnSelectedIndexChanged="selectItemGroup"
	style="width: 100%;">

<prop:HeaderTemplate>
<table border="0" width="100%">
<tr>
	<td width="50%">Name</td>
	<td width="10%">Role</td>
	<td width="10%">Active</td>
	<td width="15%">Commands</td>
</tr>
</table>
</prop:HeaderTemplate>
<prop:ItemTemplate>
<table border="0" width="100%">
<tr>
	<td align="left" width="50%"><com:TLinkButton Text=<%# $this->DataItem->name %>CommandName="select" /></td>
	<td align="left" width="10%"><%#$this->TemplateControl->RoleName($this->DataItem->role)%></td>
	<td align="left" width="10%"><%#$this->DataItem->active == 1 ? "Yes" : "No"%></td>

	<td style="text-align: right;" width="15%">
	<com:TLinkButton Text="Edit" CommandName="edit" />
	<com:TLinkButton Text="Delete" CommandName="delete" Attributes.onclick="if(!confirm('Are you sure?')) return false;" />
	</td>
</tr>
</table>
</prop:ItemTemplate>

<prop:EditItemTemplate>
<table border="0" width="100%">
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td><com:TLabel Text="<%[Group name]%>" /></td>
		<td><com:TTextBox Columns="45" ID="Groupname" Text=<%#$this->DataItem->name %> /></td>
	</tr>
	<tr>
		<td><com:TLabel Text="<%[Role]%>" /></td>
		<td><com:TDropDownList ID="grpUserRole" DataSource="<%#$this->TemplateControl->UserRoles%>" DataTextField="name" DataValueField="id" SelectedValue="<%#$this->DataItem->role%>"/></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td ><com:TCheckBox ID="grpActive" Text="Active" Checked=<%#$this->DataItem->active%>/></td>
	</td>
	<tr>
		<td valign="top">Group description</td>
		<td><com:TTextBox TextMode="MultiLine" ID="GroupDescription" Columns="45" Rows="4"  Text=<%#$this->DataItem->description%>/></td>
	</tr>
	<tr>
		<td colspan="2"><hr /></td>
	</tr>
	<tr>
		<td><com:TLinkButton Text="Save" CssClass="link-button" CommandName="update" /></td>
		<td style="text-align: right;"><com:TLinkButton Text="Cancel" CommandName="cancel" CssClass="link-button" /></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
</table>
</prop:EditItemTemplate>

<prop:FooterTemplate>

</prop:FooterTemplate>
</com:TDataList>

<com:TPager ID="Pager2"
	ControlToPaginate="dlDownloadGroups"
	FirstPageText="<<"
		LastPageText=">>"
	Mode="NextPrev"
	NextPageText=">"
	PrevPageText="<"
	OnPageIndexChanged="pageChangedDlGroup"
	/>

<com:TPager ID="DlGrpsPagerDL"
	ControlToPaginate="dlDownloadGroups"
	Mode="DropDownList"
	OnPageIndexChanged="pageChangedDlGroup"
	/>
</com:TPanel>

<com:TPanel GroupingText="Add download group" DefaultButton="SaveDownLoadGroup" Style="width: 100%;">
<table style="width: 100%;">
	<tr>
		<td colspan="2"><com:TValidationSummary Display="Dynamic" ValidationGroup="downloadgroup" /></td>
	</tr>
	<tr>
		<td>Group name</td>
		<td>
			<com:TTextBox ID="DownloadGroupName" Columns="45" />
			<com:TRequiredFieldValidator ControlToValidate="DownloadGroupName" ValidationGroup="downloadgroup" Display="Dynamic" Text="*" ErrorMessage="You need to enter a name." ControlCssClass="input-error1" />
			<com:TRegularExpressionValidator ValidationGroup="downloadgroup" Display="Dynamic" ControlToValidate="DownloadGroupName" RegularExpression="^([1-zA-Z0-1@.\s]{3,45})$" Text="*" ErrorMessage="Input must consist of at least 3 characters and max 45, only alphanumeric values." ControlCssClass="input-error1" />
			<com:TCustomValidator ControlToValidate="DownloadGroupName" ValidationGroup="downloadgroup" Display="Dynamic" Text="*" ErrorMessage="Group allready exists." ControlCssClass="input-error1" OnServerValidate="validateGroupName" />
		</td>
	</tr>
	<tr>
		<td>Role</td>
		<td>
			<com:TDropDownList ID="UserRole" DataTextField="name" DataValueField="id" />
		</td>
	</tr>
	<tr>
		<td valign="top">Group description</td>
		<td><com:TTextBox TextMode="MultiLine" ID="addGroupDescription" Columns="45" Rows="4"  /></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><com:TCheckBox ID="Active" Text="Active" /></td>
	</tr>
	<tr>
		<td colspan="2" style="text-align: right;"><com:TLinkButton ID="SaveDownLoadGroup" Text="Create" ValidationGroup="downloadgroup" CssClass="link-button" OnClick="saveGroupButtonClicked" /></td>
	</tr>
</table>
</com:TPanel>
<br />

<!-- Files in the download group -->
<com:TPanel id="grpDlFiles" GroupingText="Files in group" Style="width: 100%;">
<com:TDataList
	ID="dlDownloadFiles"
	DataKeyField="id"
	PageSize="10"
	AllowPaging="true"
	AllowCustomPaging="true"
	EnableViewState="true"
	OnEditCommand="editItemDlFile"
	OnCancelCommand="cancelItemDlFile"
	OnUpdateCommand="updateItemDlFile"
	OnDeleteCommand="deleteItemDlFile"
	HeaderStyle.CssClass="grid-header"
	HeaderStyle.Width="100%"
	ItemStyle.CssClass="grid-row1"
	ItemStyle.Width="100%"
	AlternatingItemStyle.CssClass="grid-row2"
	EditItemStyle.CssClass="grid-row-edit"
	SelectedItemStyle.CssClass="grid-row-selected"
	OnSelectedIndexChanged="selectItemFile"
	style="width: 100%;">

<prop:HeaderTemplate>
<table border="0" width="100%">
<tr>
	<td width="30%">Name</td>
	<td width="35%">Description</td>
	<td width="10%">Size</td>
	<td width="5%">Dl</td>
	<td width="5%">Active</td>
	<td width="15%" style="text-align: right;">Commands</td>
</tr>
</table>
</prop:HeaderTemplate>
<prop:ItemTemplate>
<table border="0" width="100%">
<tr>
	<td align="left" width="30%"><%# $this->DataItem->filename %></td>
	<td align="left" width="35%"><%# $this->DataItem->description %></td>
	<td align="left" width="10%"><%# sprintf("%d KB", ($this->DataItem->filesize /1024)) %></td>
	<td align="left" width="5%"><%# $this->DataItem->dlcount %></td>
	<td align="left" width="5%"><%#$this->DataItem->active == 1 ? "Yes" : "No"%></td>
	<td style="text-align: right;" width="15%">
	<com:TLinkButton Text="Edit" CommandName="edit" />
	<com:TLinkButton Text="Delete" CommandName="delete" Attributes.onclick="if(!confirm('Are you sure?')) return false;" />
	</td>
</tr>
</table>
</prop:ItemTemplate>

<prop:EditItemTemplate>
<table border="0" width="100%">
	<tr>
		<td>Filename</td>
		<td><strong><%#$this->DataItem->filename %></strong></td>
	</tr>
	<tr>
		<td>Small Description</td>
		<td><com:TTextBox Columns="45" ID="edtDescription" Text=<%#$this->DataItem->description %> /></td>
	</tr>
	<tr>
		<td valign="top">Large description</td>
		<td><com:TTextBox TextMode="MultiLine" ID="edtFileComment" Columns="45" Rows="4" Text=<%#$this->DataItem->comment %> /></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><com:TCheckBox ID="edtFileActive" Text="Active" Checked=<%#$this->DataItem->active%>/></td>
	</tr>
	<tr>
		<td><com:TLinkButton CssClass="link-button" Text="Save" CommandName="update" /></td>
		<td style="text-align: right;"><com:TLinkButton CssClass="link-button" Text="Cancel" CommandName="cancel" /></td>
	</tr>
</table>
</prop:EditItemTemplate>

</com:TDataList>

<com:TPager ID="DlFilesPager"
	ControlToPaginate="dlDownloadFiles"
	FirstPageText="<<"
	LastPageText=">>"
	Mode="NextPrev"
	NextPageText=">"
	PrevPageText="<"
	OnPageIndexChanged="pageChangedDlFiles"
	/>

<com:TPager ID="DlFilesPagerDL"
	ControlToPaginate="dlDownloadFiles"
	Mode="DropDownList"
	OnPageIndexChanged="pageChangedDlFiles"
	/>

</com:TPanel>
<br>
<com:TPanel id="pnlDownloadFiles" DefaultButton="SaveDownLoadFile" GroupingText="Add file">
<table style="width: 100%;">
	<tr>
		<td colspan="2"><com:TValidationSummary Display="Dynamic" ValidationGroup="downloadfile" /></td>
	</tr>
	<tr>
		<td style="text-align: right;"><com:TLabel Text="Download group" ForControl="DLgroup" /></td>
		<td><com:TDropDownList ID="DLgroup" DataTextField="name" DataValueField="id" /></td>
	</tr>
	<tr>
		<td style="text-align: right;">File: (max file size set by server <com:TLiteral Id="ltFileSize" />)</td>
		<td>
			<com:TFileUpload ID="FileUpload" OnFileUpload="OnFileUpload" /> <com:TButton BackColor="silver" ID="SaveDownLoadFile" Text="Send" ValidationGroup="downloadfile"/>
			<com:TRequiredFieldValidator ValidationGroup="downloadfile" EnableClientScript="true" ControlToValidate="FileUpload" ErrorMessage="Please enter your filename." ControlCssClass="required-field" />
		</td>
	</tr>
	<tr>
		<td style="text-align: right;"><com:TLabel Text="Small description" ForControl="FileDescription" /></td>
		<td>
		<com:TTextBox ID="FileDescription" Columns="45" />
		<com:TRequiredFieldValidator ControlToValidate="FileDescription" ValidationGroup="downloadfile" Display="Dynamic" Text="*" ErrorMessage="You need to enter a description." ControlCssClass="input-error1" />
		</td>
	</tr>
	<tr>
		<td style="text-align: right;" valign="top"><com:TLabel Text="Large description" ForControl="FileComment" /></td>
		<td><com:TTextBox TextMode="MultiLine" ID="FileComment" Columns="45" Rows="4" /></td>
	</tr>
</table>
</com:TPanel>